(function () {
    var EVENT_CLICK = Laya.Event.CLICK;
    var io = ppt.io;

    function roleTitle() {
        roleTitle.super(this);
        this._starSU = [];
        this._mPower = [];
        this._mSpeed = [];
        this._mEnergy = [];
        this.init();
    }
    Laya.class(roleTitle, "Com.Role.Title", ui.Role.RoleTitleUI);
    var _proto = roleTitle.prototype;

    _proto.init = function () {
        
    }
    _proto.skillTitle = function (starLength,chipNum) {
        this.starList.array = starLength;
        this.debrisNum.text = "x" + chipNum;
    }
    _proto.titleData = function (data,type) {
        var clipIndex;
        this.type = type;
        if (this.type == 0) {
            clipIndex = 1;
        } else if (this.type == 1) {
            clipIndex = 0;
        }
        else if (this.type == 2) {
            clipIndex = 3;
        }
        else if (this.type == 3) {
            clipIndex = 2;
        }
        this.debrisChoose.index = clipIndex;
        if (data.length < 1) {
            return;
        }

        var starSU = [];
        var mEnergy = [];
        var mPower = [];
        var mSpeed = [];
        this.columnList.repeatX = data.maxSpeed;
        this.speedList.repeatX = data.maxEnergy;
        this.blistersList.repeatX = data.maxPower;

        for (var j = 0; j < 5; j++) {
            if (j < data.star) {
                starSU[j] = { 'trend': 1 };

            } else {
                starSU[j] = { 'trend': 0 };
            }

        }
        for (var j = 0; j < data.maxEnergy; j++) {
            if (j < data.initEnergy) {
                mEnergy[j] = { 'speed': 1 };
            } else if (j >= data.initEnergy && j < data.energy) {
                mEnergy[j] = { 'speed': 0 };
            } else {
                mEnergy[j] = { 'speed': 2 };
            }
        }
        for (var j = 0; j < data.maxPower; j++) {
            if (j < data.initPower) {
                mPower[j] = { 'blisters': 1 };
            } else if (j >= data.initPower && j < data.power) {
                mPower[j] = { 'blisters': 0 };
            } else {
                mPower[j] = { 'blisters': 2 };
            }
        }
        for (var j = 0; j < data.maxSpeed; j++) {
            if (j < data.initSpeed) {
                mSpeed[j] = { 'column': 1 };
            } else if (j >= data.initSpeed && j < data.speed) {
                mSpeed[j] = { 'column': 0 };
            } else {
                mSpeed[j] = { 'column': 2 };
            }
        }
        this._starSU.push(starSU);   //星级数量
        this._mPower.push(mPower);   //水泡
        this._mSpeed.push(mSpeed);   //数量
        this._mEnergy.push(mEnergy); //水柱
        this.debrisNum.text = "x" + data.chip;
        this.starList.array = starSU;
        this.blistersList.array = mPower;
        this.columnList.array = mSpeed;
        this.speedList.array = mEnergy;
    }
})();